(Sorry, but as I wrote this in the body of the example code it sounded like it belonged in a document all its own. Hope you don't mind.)
The files in the Framework folder represent a cdev shell from which to create a working cdev. It includes a CW cdev project, a resource file stocked with cdev type resources, and source code for building your cdev. You may want to keep an unmodified version of the folder and then make a copy of it when you want to create a new cdev.
Basically the framework is a message passer. There is one method for each message that the OS passes to the control panel. I won't bother to list all the messages here. If you are interested, check out the switch blocks in CDEVMain.c and TControlPanel.cp or NIM: More Macintosh Toolbox Ch 8.
To use the framework, you need to create a class based on the TControlPanel class (see TControlPanel.cp and TControlPanel.h). You'll need to override only those methods that you need to use. The default action for most of the methods in the base class is to return noErr. The only exceptions are the cut(), copy(), paste(), and clear() methods. They each make the appropriate DlgXXXX() toolbox call to handle the standard editing commands and then return noErr. Use the code in CDEV.cp and its header file CDEV.h to get you started on writing your own cdev class.
Each method returns a long indicating the success or failure of the operation. Return zero for success, anything else for failure. If you return a non-zero result, the control panel WILL CLOSE and, depending on your return code, post an alert message to the user indicating the reason for the closure. Allowable error codes for control panels are discussed in NIM: More Macintosh Toolbox pg. 8-47. I'll list them here for your reference:
cdevGenErr -1 Generic Error; doesn't post a message, just closes the control panel
cdevMemErr 0 Insufficient Memory; displays an out of memory alert
cdevResError 1 Missing resource; displays a missing resource alert
Returning cdevResError or cdevGenErr from your methods will generate the appropriate action. Returning cdevMemErr, however, will not cause the closure of the control panel since it's value is zero and zero indicates success. To generate the Insufficient Memory error, return the framework constant cdevFWMemErr. If your error code does not match any of the allowable error return codes, a generic error code (cdevGenErr) will be returned to the OS.
In addition to creating your own cdev object, there are 2 additional functions that you must have. One is:
long runable(void);
runable() tells the OS if this CDEV can run on this Macintosh. Return 1 if it can and 0 (zero) if it can't. If your machine ('mach') resource is set to run on all Mac's then (according to IM) you won't get an macDev message which means that runable() won't get called.
The framework takes care of deleting the object when the cdev closes or you return a non-zero result from one of the overridden methods.
Hopefully that's enough to get you started. As I indicated in the "About CW CDEV Framework" document, I'm more than happy to answer questions or help you solve problems related to using the framework. "Digital" mail works best for me, but "analog" mail is OK too.